<?
$tpl_file_name = TEMPLATE_PATH."/admin_password.html";

$f = fopen ($tpl_file_name, "r");
$page_content = fread ($f, 1000000);
fclose ($f);


$rep["{PASSWORD_ID}"] = "";
$rep["{CLIENT_LOGIN}"] = "";
$rep["{CLIENT_SITE}"] = "";
$rep["{PASSWORDS}"] = "";


$sql = "SELECT client_login, client_site FROM ".TABLE_CLIENTS." WHERE client_id = ".$_POST['id']."";
$sql = mysql_query($sql) or die(mysql_error());
$client = mysql_fetch_array($sql);
$rep["{CLIENT_LOGIN}"] = $client['client_login'];
$rep["{CLIENT_SITE}"] = $client['client_site'];


$sql = "SELECT * FROM ".TABLE_PASSWORDS." WHERE password_client = ".$_POST['id']." ORDER BY password_type ASC";
$sql = mysql_query($sql) or die(mysql_error());
while ($result = mysql_fetch_object($sql)) {
	$rep["{PASSWORDS}"] .= '
	  <tr>
		<td bgcolor="#E2E2E2"><b>'.$result->password_type.'</b></td>
		<td bgcolor="#E2E2E2">'.$result->password_login.'</td>
		<td bgcolor="#E2E2E2">'.$result->password_password.'</td>
		<td bgcolor="#E2E2E2"><a href="http://'.$result->password_host.'" target="_blank">'.$result->password_host.'</a></td>
	  </tr>
	';
}


$page_content = strtr ($page_content, $rep);
echo $page_content;
?>